<template>
  <div class="testvuex">
       {{$store.state.count}}-{{count}}
      <button @click="$store.commit('add',{'a':10})">add</button>

      <button @click="jiaplus(100)">addplus</button>
  </div> 
</template>

<script>
import {mapState,mapMutations,mapGetters,mapActions} from 'vuex'
export default {
  name: 'testvuex',
  props : [],
  data(){
    return {
    }
  },
  /*computed:mapState({
    count:state=>state.count
  }),*/
  /*computed:mapState([
    "count"
  ]),*/
  computed:{
    ...mapState([
        "count"
      ]),
    /*count(){
      this.$store.getters.count
    }*/
    ...mapGetters([
      "count"
    ])
    /*count(){
      return this.$store.state.a.count
    }*/
  },
  methods:{
   /* ...mapActions([
        "jiaplus"
    ])*/
    ...mapActions({
      jiaplus:"jiaplus"
    })
  },
  mounted(){
    
  }
}

</script>

<style lang="scss" scoped>
  .testvuex{
    button{
      background-color:#000;
    }
  }
</style>
